<include file="Public/common1" />
<block name="content">
    <style>
        th,td{text-align: center;}
        .row-2{
            padding: 0px 10px;
        }

        .row-input-width{
            width: 347px!important;
        }
        .form-group{
            margin-bottom: 15px!important;
        }
        .pull-right{
            margin-right: 14px!important;
        }
        .orderNo-item{
            padding-left: 28px;
        }
        .bill-time-item{
            padding-left: 14px;
        }
        .range-item{
            padding:  10px;
            background-color: #eee;
        }

        .input-left{
            display: inline-block;
        }
        .col-xs-2,.col-xs-1{
            padding: 0;
        }
        .btn-warp{
            margin-bottom: 10px;
            text-align: left;
        }
    </style>
    <div class="page-header"><h1><i class="fa fa-home"></i> 首页 &gt; 财务管理 &gt; 发票管理</h1></div>

    <div class="col-xs-12">
        <div class="tab-content">
            <div class="row" >
                <form action="" class="form-inline " id="form" style="margin-left:10px;" >
                    <div class="row-2 clearfix" >
                        <div class="form-group col-xs-6">
                            <label for="open_time" class="bill-time-item col-xs-2">开票时间:</label>
                            <div class="col-xs-4">
                                <input  class="form-control" name="start_open_time" id="start" placeholder="开始时间" value="<if condition="$_GET['start_open_time']">{$_GET['start_open_time']}</if>" />
                            </div>
                           <!--  <div class="col-xs-1" style="text-align:center">
                                <span class="range-item input-left">至</span>
                            </div> -->
                            <div class="col-xs-4">
                                <input class="form-control"  name="end_open_time" id="end" placeholder="结束时间" value="<if condition="$_GET['end_open_time']">{$_GET['end_open_time']}</if>">
                            </div>
                        </div>
                        <div class="form-group col-xs-6">
                            <label for="source_type" class="bill-time-item col-xs-2">开据人:</label>
                            <div class="col-xs-6"><input type="text" name="open_user" class="form-control" value="<if condition="$_GET['open_user']">{$_GET['open_user']}</if>"  /></div>
                        </div>
                     </div>
                    <div class="row-2 clearfix" >
                        <div class="form-group col-xs-6">
                            <label for="order_num" class="orderNo-item col-xs-2">订单号:</label>
                            <div class="col-xs-6"><input type="text" class="form-control" name="order_num" id="order_num" value="<if condition="$_GET['order_num']">{$_GET['order_num']}</if>"></div>

                        </div>
                        <div class="form-group col-xs-6">
                            <label for="line_name" class="col-xs-2">线路名称:</label>
                            <div class="col-xs-6"><input type="text" class="form-control" name="line_name" id="line_name" value="<if condition="$_GET['line_name']">{$_GET['line_name']}</if>"></div>

                        </div>
                    </div>
                    <div class="row-2 clearfix">
                        <div class="form-group col-xs-6">
                            <label for="tourists_phone" class="col-xs-2">会员手机:</label>
                            <div class="col-xs-6"><input type="text" class="form-control" name="tourists_phone" id="tourists_phone" value="<if condition="$_GET['tourists_phone']">{$_GET['tourists_phone']}</if>"></div>

                        </div>
                        <div class="form-group col-xs-6">
                            <label for="receipt_rise" class="col-xs-2">发票抬头:</label>
                            <div class="col-xs-6"><input type="text" class="form-control" name="receipt_rise" id="receipt_rise" value="<if condition="$_GET['receipt_rise']">{$_GET['receipt_rise']}</if>"></div>

                        </div>

                    </div>
                    <div class="row-2 clearfix btn-warp" >
                        <button type="submit" class="btn btn-primary">查询</button>
                        <if condition = "checkAuth('Reseller/Finance/outBillListExportExcel')">
                        <button type="button" onclick="exportExcel()" class="btn btn-primary">导出</button>
                        </if>
                        <!-- <a href="{:U('outBillListExportExcel')}" class="btn btn-primary btn-xs pull-right">导出</a> -->
                    </div>
                </form>
            </div>
        </div>

        <div class="tabbable">
  <!--           <ul class="nav nav-tabs padding-12 tab-color-blue background-blue" id="myTab">
                <li class="active"><a href="{:U('Rule/admin_user_list')}">员工列表</a></li>
                <li><a href="{:U('Rule/add_admin')}">添加员工</a></li>
            </ul> -->
            <div class="tab-content">
                <table class="table table-striped table-bordered table-hover table-condensed">
                    <tr>
                        <th>订单号</th>
                        <th>线路名称</th>
                        <th>销售价</th>
                        <th>发票代码</th>
                        <th>发票号码</th>
                        <th>发票金额</th>
                        <th>发票抬头</th>
                        <th>发票内容</th>
                        <th>开票时间</th>
                        <th>开据人</th>
                        <th>备注</th>
                    </tr>
                    <foreach name="list" item="v">
                        <tr>
                            <td>{$v['order_num']}</td>
                            <td>{$v['line_name']}</td>
                            <td>{$v['need_pay']}</td>
                            <td>{$v['receipt_code']}</td>
                            <td>{$v['receipt_num']}</td>
                            <td>{$v['receipt_amount']}</td>
                            <td>{$v['receipt_rise']}</td>
                            <td>{$v['receipt_content']}</td>
                            <td>{$v['open_time']|date='Y-m-d',###}</td>
                            <td>{$v['open_user']}</td>
                            <td>{$v['remarks']}</td>
                        </tr>
                    </foreach>
                </table>
                <!--分页样式-->
                <ul class="pagination pull-right">
                    {$show}
                </ul>
            </div>
        </div>
    </div>
    <script src="__JS__/jedate/jedate.js"></script>
    <script>
       function exportExcel(){
            $('#form').attr('action','{:U('outBillListExportExcel')}');
            $('#form').submit();
            $('#form').attr('action','');
       }
       dateFormat($('#start'), 'YYYY-MM-DD');
       dateFormat($('#end'), 'YYYY-MM-DD');

        /**
         * 绑定日期选择器
         * @param  {[obj]}    obj        [元素]
         * @param  {[string]} dateFormat [时间格式]
         */
        function dateFormat(obj, dateFormat){
            jeDate({
                dateCell: '#'+$(obj).attr('id'),
                format: dateFormat,
                isinitVal:false,
                isTime:true, //isClear:false,
                okfun:function(val){
                }
            });
        }
    </script>
</block>
